package com.uade.magicCompany.controler;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.uade.magicCompany.controler.utitilities.ActionConstants;
import com.uade.magicCompany.services.GestionGrupoUsuarios;
import com.uade.magicCompany.services.GestionGrupoUsuariosImpl;

public class CrearGrupoAction extends ActionSupport implements SessionAware {

	private static final long serialVersionUID = 1L;
	private String nombre;
	
	private Map<String, Object> userSession ;

	@Override
	public void setSession(Map<String, Object> session) {
		userSession = session;
	}
	
	public String execute() throws Exception {
		String user = (String) ActionContext.getContext().getSession().get(ActionConstants.USER_LOGGED);
		GestionGrupoUsuarios gestionGrupo = new GestionGrupoUsuariosImpl();
		System.out.println("Creando grupo: " + nombre);
		gestionGrupo.crearGrupoUsuario(user, nombre);
		return SUCCESS;
	}

	public String getNombre() {
		return nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}
	
	

}
